-
Notifications
You must be signed in to change notification settings - Fork 1
Prevent request to pay being clicked twice #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures the “Request to Pay” button only appears once per bill and displays the payment address after a request has been made.
- Introduces the
paymentStatusSDK call and fetchesrequestedToPay/paymentAddress. - Adds conditional rendering of the pay button and payment address row.
- Propagates
requestedToPayintoQuoteActionsand updates toast IDs.
Comments suppressed due to low confidence (3)
src/pages/quotes/QuotePage.tsx:483
- Update the title/description to refer to “pay” instead of “mint” for consistency with the button text and new feature.
title="Confirm requesting to mint"
src/pages/quotes/QuotePage.tsx:440
- Include the error message (e.g.,
+ ": " + error.message) to aid debugging when the mutation fails.
<span>
src/pages/quotes/QuotePage.tsx:744
- Add tests to cover the new behavior: button hidden when
requestedToPayis true and payment address displayed.
{requestedToPay ? (
| enabled: shouldFetchKeyset, | ||
| }) | ||
|
|
||
| const { data: paymentData } = useQuery({ |
Copilot
AI
Jul 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an enabled: !!billId flag to this query to avoid unnecessary network requests when billId is empty.
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
|
|
||
| {value.status === "Accepted" && "keyset_id" in value && !ebillPaid && !newKeyset ? ( | ||
| {value.status === "Accepted" && "keyset_id" in value && !ebillPaid && !newKeyset && !requestedToPay ? ( | ||
| <ConfirmDrawer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit confusing that this button and the confirmation vary between "request to pay" and "request to mint" 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll adjust for consistency
Deploying wildcat-dashboard with
|
| Latest commit: |
32307b7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f5b524d9.wildcat-dashboard.pages.dev |
| Branch Preview URL: | https://stefan-requestpay.wildcat-dashboard.pages.dev |
User description
📝 Description
Checks whether request to pay has been initiated, and only display the request to pay button if not, otherwise display the address.
Closes #55
Requires payment status to be exposed and merged in Wildcat
✅ Checklist
Please ensure the following tasks are completed before requesting a review:
npm run lintor the equivalent linting command.PR Type
Enhancement
Description
Prevent duplicate request-to-pay clicks by checking payment status
Display payment address when request has been initiated
Add payment status API integration and types
Update UI to conditionally show request button or address
Changes diagram
flowchart LR A["User clicks request to pay"] --> B["Check payment status"] B --> C{Already requested?} C -->|No| D["Show request button"] C -->|Yes| E["Show payment address"] D --> F["Allow payment request"] E --> G["Prevent duplicate clicks"]Changes walkthrough 📝
sdk.gen.ts
Add payment status API endpointsrc/generated/client/sdk.gen.ts
BillPaymentDataandBillPaymentStatetype importspaymentStatusAPI function for checking payment statustypes.gen.ts
Add payment status type definitionssrc/generated/client/types.gen.ts
BillWaitingForPaymentStatetype with payment detailsBillPaymentStatustype with request status flagsBillPaymentStateandBillPaymentDatatypes for APIQuotePage.tsx
Implement payment status checking and UI updatessrc/pages/quotes/QuotePage.tsx
paymentStatusAPI functionrequestedToPayprop toQuoteActionscomponent